package com.oracle.dao.senior;


import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;

import com.oracle.entity.senior.Scenic;
import com.oracle.jdbc.ConnJDBC;

public class ScenicDao {
	public ArrayList<Scenic> findArrayList(){
		ArrayList<Scenic> list=new ArrayList<Scenic>();
		
		Connection conn=ConnJDBC.getConnection();
		String sql="select name,proc from senior";
		try {
			PreparedStatement ps=conn.prepareStatement(sql);
			
			ResultSet rs=ps.executeQuery();
			while(rs.next()){
				String name=rs.getString(1);
				String proc=rs.getString(2);
				//System.out.println(proc);
				Scenic scenic=new Scenic(name,proc);
				list.add(scenic);
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return list;
	}
//	public static void main(String[] args){
//		ScenicDao sd=new ScenicDao();
//		sd.findArrayList();
//	}
}
